<template>
	<view>
		<!-- 广告图 -->
		<banner :inset='con'></banner>
		<view class="sizheng" v-if="cokei =='2'">
			<text class="btwz">思政课程</text>
			<view class="sizh">
				<view class="sz_zt" v-for="(item,index) in conte" @click="sizheng(item.id)" :key="index">
					<view class="sz_t">
						<image :src="item.faceUrl" mode="heightFix"></image>
					</view>
					<text class="wenzi">{{item.name}}</text>
				</view>
			</view>
		</view>
		<!-- 横线 -->
		<hengxian v-if="cokei =='2'"></hengxian>
		
		<view class="sizheng" v-if="cokei =='2'">
			<text class="btwz">课程思政</text>
			<view class="sizh">
				<view class="sz_zt" v-for="(item,index) in kecon" @click="tz(item.id)" :key="index">
					<view class="sz_t">
						<image :src="item.faceUrl" mode="heightFix"></image>
					</view>
					<text class="wenzi">{{item.name}}</text>
				</view>
			</view>
		</view>
		<!-- 横线 -->
		<hengxian v-if="cokei =='2'"></hengxian>
		
		<!-- 影视资源 -->
		<view class="sizheng">
			<text class="btwz">影视资源</text>
			<view class="zybos">
				<scroll-view class="" :scroll-x="true" style="white-space: nowrap;">
					<view class="zy" v-for="(item,index) in jy" @click="yingshi(item.id)">
						<view class="zy_t">
							<image :src="item.faceUrl" mode="widthFix"></image>
						</view>
						<text>{{item.name}}</text>
					</view>
				</scroll-view>
			</view>
		</view>
		<!-- 横线 -->
		<hengxian></hengxian>
		
		<!-- 思政刊物-->
		<view class="sizheng">
			<text class="btwz">思政刊物</text>
			<!-- <view class="sizh">
				<view class="sz_zt" v-for="(item,index) in conte" @click="tz(item.path)" :key="index">
					<view class="sz_t">
						<image :src="item.url" mode=""></image>
					</view>
					<text class="wenzi">{{item.title}}</text>
				</view>
			</view> -->
			<view style="margin-top: 20upx; text-align: center;">
				敬请期待
			</view>
		</view>
	</view>
</template>

<script>
	// import {mapState,mapMutations,forcedLogin} from 'vuex'
	export default{
		// computed:mapState(['hasLogin','uerInfo']),
		data(){
			var con = '/static/banner/jx.png'
			return{
				con:con,
				conte:[],
				kecon:[],
				jy:[],
				token:'',
				cokei:''
			}
		},
		onShow() {
			this.xuanran()
			this.token = uni.getStorageSync('token')
			if(this.token == ''){
				uni.reLaunch({
					url:'/pages/index/logo/logo'
				})
			}else{
				uni.navigateTo({
					url:'/pages/xue/index'
				})
			}
		},
		created() {
			
		},
		methods:{
			xuanran(){
				// uni.showLoading({
				// 	title: '正在加载',
				// 	mask: false
				// });
				this.cokei = uni.getStorageSync('cokei')
				let that = this
				let params = {
				  "pageNo":1,
				  "pageSize":99999
				}
				that.pyReq(that.$http.getMindClazzList,params,function(res){
					that.conte = res.result
				});
				// let headers={
				// 	  'content-type': 'application/x-www-form-urlencoded',
				// 	  'token': uni.getStorageSync('token')
				// }
				//  uni.request({
				// 	  url: that.$http.getMindClazzList,
				// 	  method: 'POST',
				// 	  data:params,
				// 	  header:headers,
				// 	  success: (res)=>{
				// 		  console.log(res)
				// 		  if(res.data.code == '1001'){
				// 			  uni.clearStorageSync();
				// 			  uni.showModal({
				// 			      title: '提示',
				// 			      content: res.data.msg,
				// 			      success: function (res) {
				// 			          if (res.confirm) {
				// 			             uni.reLaunch({
				// 			             	url:'/pages/index/logo/logo'
				// 			             })
				// 			          } else if (res.cancel) {
				// 			              console.log('用户点击取消');
				// 			          }
				// 			      }
				// 			  });
				// 		  }else{
				// 			  that.conte = res.data.result
				// 		  }
				// 		  uni.hideLoading();
				// 	  },
				// 	  fail: (err)=>{
				// 		  console.log(err)
				// 	  }
				// })  
				// 课程思政
				that.pyReq(that.$http.getClazzMindTypeList,{pageNo:1,pageSize:99999},function(res){
					console.log('==========>>');
					that.kecon = res.result
				});
				// uni.request({
				// 	  url: that.$http.getClazzMindTypeList,
				// 	  method: 'POST',
				// 	  header:headers,
				// 	  success: (res)=>{
				// 		  console.log(res)
				// 		  if(res.data.code == '1001'){
				// 			  uni.showModal({
				// 			      title: '提示',
				// 			      content: res.data.msg,
				// 			      success: function (res) {
				// 			          if (res.confirm) {
				// 			             uni.reLaunch({
				// 			             	url:'/pages/index/logo/logo'
				// 			             })
				// 			          } else if (res.cancel) {
				// 			              console.log('用户点击取消');
				// 			          }
				// 			      }
				// 			  });
				// 		  }else{
				// 			  that.kecon = res.data.result
				// 		  }
				// 	  },
				// 	  fail: (err)=>{
				// 		  console.log(err)
				// 	  }
				// })  
				that.pyReq(that.$http.getMovieTypeList,{},function(res){
					that.jy = res.result
				});
				/* 影视 */
				// uni.request({
				// 	  url: that.$http.getMovieTypeList,
				// 	  method: 'POST',
				// 	  header:headers,
				// 	  success: (res)=>{
				// 		  console.log(res)
				// 		  if(res.data.code == '1001'){
				// 			 uni.showModal({
				// 			     title: '提示',
				// 			     content: res.data.msg,
				// 			     success: function (res) {
				// 			         if (res.confirm) {
				// 			            uni.reLaunch({
				// 			            	url:'/pages/index/logo/logo'
				// 			            })
				// 			         } else if (res.cancel) {
				// 			             console.log('用户点击取消');
				// 			         }
				// 			     }
				// 			 });
				// 		  }else{
				// 			  that.jy = res.data.result
				// 		  }
				// 	  },
				// 	  fail: (err)=>{
				// 		  console.log(err)
				// 	  }
				// }) 
			},
			sizheng(id){
				console.log(id)
				uni.navigateTo({
					url:'/pages/index/jiaoxue/kechenglist?id='+id
				})
			},
			tz(id){
				uni.navigateTo({
					url:'/pages/index/jiaoxue/list?id='+id
				})
			},
			yingshi(id){
				console.log(id)
				uni.navigateTo({
					url:'/pages/index/jiaoxue/jilu?id='+id
				})
			}
			
		}
	}
</script>

<style>
	.sizheng{
		margin-top: 20upx;
	}
	.btwz{
		font-size: 30upx;
		margin-left: 43upx;
	}
	.sizh{
		display: flex;
		flex-wrap: wrap;
		/* justify-content: space-between; */
		padding: 0 23upx;
	}
	.zybos{
		/* display: flex; */
		padding: 0 40upx;
	}
	.zy{
		width: 320upx;
		margin: 20upx 20upx;
		display: inline-block;
	}
	.zy text{
		font-size: 28upx;
		font-weight: 700;
		padding-left: 20upx;
		padding-top: 30upx;
		display: block;
	}
	.zy_t{
		width: 320upx;
		height: 160upx;
		border-radius: 10upx;
		overflow: hidden;
	}
	.sz_t{
		width: 221upx;
		height: 147upx;
		border-radius: 10upx;
		overflow: hidden;
	}
	.sz_t>image{
		display: block;
		height: 147upx;
		margin: 0 auto;
	}
	.sz_zt{
		width: 221upx;
		margin: 20upx 6upx;
	}
		.wenzi{
			display: block;
			text-align: center;
			font-size: 26upx;
			margin-top: 16upx;
			overflow: hidden;
			text-overflow:ellipsis;
			white-space: nowrap;
		}
</style>
